<!--ADDBOX-->
<div class="row-fluid sortable">
	<div class="box span12">
		<div class="box-header well" data-original-title>
			<h2><i class="icon-plus"></i> New Images</h2>
			<div class="box-icon">
				<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-down"></i></a>
				<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
			</div>
		</div>
		<div id="box-add" class="box-content" style="display: none">
			<form class="form-horizontal" method="POST" action="<?php echo $this->Html->url(array('controller' => 'images', 'action' => 'add', 'api' => true));?>">
			  <fieldset>
				<legend>New Images</legend>   
			  	<div class="control-group">
				  <label class="control-label" for="ImageItem">Item</label>
				  <div class="controls">
				  	<select id="ImageItem" name="data[Image][item_id]" required="required" data-rel="chosen">
						<?php foreach($items as $item):?>
				  			<option value="<?php echo $item['Item']['id'];?>"><?php echo $item['Item']['name'];?></option>
				  		<?php endforeach;?>
				  	</select>
				  </div>
			  	</div>
			  	<div class="control-group">
				  <label class="control-label" for="ItemImage">Images</label>
				  <div class="controls">
				  	<button onclick="javascript: FacebookPhotoBox.show();" title="Import from Facebook" data-rel="tooltip" type="button" class="btn btn-warning">Facebook</button>
				  	&nbsp;or&nbsp; <button onclick="javascript: UploadPhotoBox.show();" title="Upload Photos" data-rel="tooltip" type="button" class="btn btn-warning">Upload</button>
				  </div>
			  	</div> 			  						
				<div class="form-actions">
				  <button type="submit" class="btn btn-primary">Save</button>
				  <button id="reset" type="reset" class="btn">Reset</button>
				</div>
			  </fieldset>
			  <ul id="fb-photo-selected" class="thumbnails gallery"></ul>
			</form>
		</div>
	</div>
</div>
<?php echo $this->element('fbimport');?>
<?php echo $this->element('photoupload');?>
<!--TABLE-->
<div class="row-fluid sortable">		
	<div class="box span12">
		<div class="box-header well" data-original-title>
			<h2><i class="icon-camera"></i> Image Management</h2>
			<div class="box-icon">
				<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
				<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
			</div>
		</div>
		<div id="box-index" class="box-content" alt="<?php echo $this->Html->url(array('controller' => 'images', 'action' => 'index', 'ajax' => true, $item_id));?>">	
		</div>
	</div>
</div>

<!-- SCRIPT -->
<script type="text/javascript">
$(document).ready(function () {
	IndexBox.display();
	AddBox.listen();
	FacebookPhotoBox.display();
	FacebookPhotoBox.listen();	
});
</script>